﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Common
{
    public static class ArrayHelper
    {
        public static string[] ConvertToStringArray(this int[] intarray)
        {
            string[] stringarray = new string[intarray.Length];
            for (int i = 0; i < intarray.Length; i++)
            {
                stringarray[i] = intarray[i].ToString();
            }
            return stringarray;
        }

        public static string[] ConvertToStringArray(decimal[] decimalarray)
        {
            string[] stringarray = new string[decimalarray.Length];
            for (int i = 0; i < decimalarray.Length; i++)
            {
                stringarray[i] = decimalarray[i].ToString();
            }
            return stringarray;
        }

        /// <summary>
        /// 将String数组转换为Int数组
        /// </summary>
        /// <param name="strintarray"></param>
        /// <returns></returns>
        public static int[] ConvertToIntArray(this string[] strintarray)
        {
            int[] intarray = new int[strintarray.Length];
            for (int i = 0; i < strintarray.Length; i++)
            {
                intarray[i] = int.Parse(strintarray[i]);
            }
            return intarray;
        }
    }
}
